import Mock from 'mockjs'

const List = []
const count = 100

for (let i = 0; i < count; i++) {
  List.push(Mock.mock({
    'id': '@increment',
    'groupName': '@cname',
    'groupSort|1': ['区级', '市级'],
    'groupDesc': '@word(5)',
    'groupTime': Mock.Random.datetime('yyyy-MM-dd A HH:mm:ss')
  }))
}

export default [
  {
    url: '/groupMgr/getList',
    type: 'post',
    response: config => {
      const { page = 1, limit = 10 } = config.query
      const pageList = List.filter((item, index) => index < limit * page && index >= limit * (page - 1))
      return {
        code: 20000,
        data: {
          total: List.length,
          items: pageList
        }
      }
    }
  }
]
